#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int days, n, date;

int main()
{
    cin >> n;
    while (n) {
        days++;
        if (!date && n % 3 == 1)  date = days;

        n -= (n + 2) / 3;
    }
    cout << days << ' ' << date << endl;
    return 0;
}